/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package helper;

import java.awt.Component;
import java.awt.Container;
import java.net.Inet4Address;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;

/**
 *
 * @author Fernando
 */
public class MetodosUteis {

     public static String formataMoeda(double vlr) {
        java.text.DecimalFormat df = new java.text.DecimalFormat("R$ ###,###,##0.00");
        return df.format(vlr);
    }

     
     public static void showMsg(String msg){
         System.out.print(msg);
     }
 
    public static String getDateNow() {
        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
        Date data = new Date(System.currentTimeMillis());
        String valorDate = new String();

        try {
            valorDate = sdf.format(data);//cal.getTime().toString());
        } catch (IllegalArgumentException e) {
        }
        return valorDate;
    }

    /**
     * Manipula a data conforme o parametro
     * Se parametro for positivo, soma na data atual
     * Se negativo, diminui da data atual
     * @param int numero de dias a manipular
     * @return Date
     */
    public static Date getDataManipulada(int addDay) {
        Calendar cal = new GregorianCalendar();
        cal.add(Calendar.DAY_OF_MONTH, +addDay);
        return cal.getTime();
    }

    public static String FormataDataddMMyyyy(Date valor) {
        String data = null;
        if (null != valor) {
            SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
            data = sdf.format(valor);
        }
        return data;
    }

 
}
